<?php
/*
 * @Author: your name
 * @Date: 2022-01-04 15:27:52
 * @LastEditTime: 2022-03-10 13:50:03
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /nlog/routes/dailyPartTime.php
 */

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\crm\Login;                            //登录类
use App\Http\Controllers\crm\CheckRole;                        //检查登录状态类
use App\Http\Controllers\crm\CrmLinkman;                       //联系人    
use App\Http\Controllers\crm\CrmFollowUp;                      //跟进记录        
use App\Http\Controllers\crm\CrmCustomer;                      //客户        
use App\Http\Controllers\crm\CrmProduct;                       //产品    
use App\Http\Controllers\crm\CrmContract;         //合同

use App\Http\Controllers\admin_controller\Upload;              //文件上传
use App\Http\Controllers\crm\CrmSituation;
use App\Http\Controllers\crm\Admins;
use App\Http\Controllers\crm\CrmDivision;     //crm系统所属部门


/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::any('/login', [Login::class, 'index']);              //登录
Route::any('/loginOut', [Login::class, 'loginOut']);        //退出登录

// Route::any('/test', function(){
//     return phpinfo();
// });        //退出登录

Route::middleware('CheckCrmToken')->group(function () {                             //检查是否登录
    Route::post('/checkRole', [CheckRole::class, 'CheckRole']);                     //获取权限信息


    Route::middleware('writelog')->group(function () {                           //日志中间件

        Route::prefix('/crmDivision')->group(function () {
            Route::post('/divisionList', [CrmDivision::class, 'divisionList']);                 //所属部门列表
            Route::post('/divisionOptional', [CrmDivision::class, 'divisionOptional']);         //所属部门可选部门
        });
        Route::prefix('/crmLinkman')->group(function () {
            Route::post('/linkmanAdd', [CrmLinkman::class, 'linkmanAdd'])->name('联系人/添加');              //联系人添加
            Route::post('/linkmanEdit', [CrmLinkman::class, 'linkmanEdit'])->name('联系人/编辑');            //联系人修改
            Route::post('/linkmanList', [CrmLinkman::class, 'linkmanList']);            //联系人列表
            Route::post('/linkmanSelOne', [CrmLinkman::class, 'linkmanSelOne']);        //联系人单条
            Route::post('/linkmanGirdData', [CrmLinkman::class, 'linkmanGirdData']);        //联系人小列表
            Route::post('/attachmentList', [CrmLinkman::class, 'attachmentList']);        //附件列表
            Route::post('/attachmentSave', [CrmLinkman::class, 'attachmentSave'])->name('联系人附件/保存|删除');        //附件保存
        });

        Route::prefix('/crmFollowUp')->group(function () {
            Route::post('/crmFollowUpAdd',    [CrmFollowUp::class, 'crmFollowUpAdd'])->name('沟通记录/添加');
            Route::post('/crmFollowUpEdit',   [CrmFollowUp::class, 'crmFollowUpEdit'])->name('沟通记录/编辑');
            Route::post('/crmFollowUpSelOne', [CrmFollowUp::class, 'crmFollowUpSelOne']);
        });

        Route::prefix('/crmCustomer')->group(function () {
            Route::post('/customerAdd', [CrmCustomer::class, 'customerAdd'])->name('客户/添加');               //客户添加
            Route::post('/customerEdit', [CrmCustomer::class, 'customerEdit'])->name('客户/编辑');             //客户修改
            Route::post('/customerList', [CrmCustomer::class, 'customerList']);                               //客户列表
            Route::post('/customerSelOne', [CrmCustomer::class, 'customerSelOne']);                           //客户单条
            Route::post('/customerChange', [CrmCustomer::class, 'customerChange'])->name('客户/转移');          //客户转移
            Route::post('/customerApplyList', [CrmCustomer::class, 'customerApplyList']);                     //客户转移审批列表
            Route::post('/customerManyEdit', [CrmCustomer::class, 'customerManyEdit'])->name('客户/批量审批');    //客户批量修改
            Route::post('/customerPool', [CrmCustomer::class, 'customerPool']);                               //客户池列表
            Route::post('/customerLinkmanId', [CrmCustomer::class, 'customerLinkmanId']);                        //查询已选中
        });

        Route::prefix('/crmProduct')->group(function () {
            Route::post('/productAdd', [CrmProduct::class, 'productAdd'])->name('产品/添加');              //产品添加
            Route::post('/productEdit', [CrmProduct::class, 'productEdit'])->name('产品/编辑');            //产品编辑
            Route::post('/productSelOne', [CrmProduct::class, 'productSelOne']);        //产品查单条
            Route::post('/productList', [CrmProduct::class, 'productList']);            //产品列表
        });


        Route::prefix('/crmContract')->group(function () {
            Route::post('/contractAdd', [CrmContract::class, 'contractAdd'])->name('合同/添加');              //合同添加
            Route::post('/contractEdit', [CrmContract::class, 'contractEdit'])->name('合同/编辑');            //合同编辑
            Route::post('/contractSelOne', [CrmContract::class, 'contractSelOne']);        //合同查单条
            Route::post('/contractList', [CrmContract::class, 'contractList']);            //合同列表
        });

        Route::prefix('/upload')->group(function () {
            Route::post('/manyFile', [Upload::class, 'manyFile']);                         //多图上传
            Route::post('/uploadOneFile', [Upload::class, 'uploadOneFile']);               //单文件上传
        });



        Route::prefix('/situation')->group(function () {
            Route::post('/situationUpdateAdd', [CrmSituation::class, 'situationUpdateAdd'])->name('跟进记录/添加|修改');  //添加修改
            Route::post('/situationList', [CrmSituation::class, 'situationList']);  //列表
        });

        
        


        Route::prefix('/admin')->group(function () {
            Route::post('/mineMsg', [Admins::class, 'mineMsg']);              //个人用户信息
            Route::post('/mineMsgEdit', [Admins::class, 'mineMsgEdit']);      //用户信息编辑
            Route::post('/checkUserName', [Admins::class, 'checkUserName']);  //用户名查重
            Route::post('/adminsList', [Admins::class, 'adminsList']);        //用户列表
        });
    });
});

Route::any('/uploadGET', [Upload::class, 'uploadGET']);
